//class ValidatorUitl

    export  class ValidatorUitl
    {
       

        public static isNumber(arg1: string): Boolean
        {
            var loc1=new RegExp("^\\d+$", "mi");
            return loc1.test(arg1);
        }

        public static isChar(arg1: string): Boolean
        {
            var loc1=new RegExp("^[\0-ÿ]{1}$", "mi");
            return loc1.test(arg1);
        }

        public static isLetter(arg1: string): Boolean
        {
            var loc1=new RegExp("^[a-z]{1}$", "mi");
            return loc1.test(arg1);
        }

        public static isEn(arg1: string): Boolean
        {
            var loc1=new RegExp("^[a-z]+$", "mi");
            return loc1.test(arg1);
        }

        public static isENum(arg1: string): Boolean
        {
            var loc1=new RegExp("^[0-9a-z]+$", "mi");
            return loc1.test(arg1);
        }

        public static isBoolean(arg1: string): Boolean
        {
            var loc1=new RegExp("^(true|false)$", "mi");
            return loc1.test(arg1);
        }

        public static isEmail(arg1: string): Boolean
        {
            var loc1=new RegExp("^[^\\s\\@]+\\@[^\\s\\@]+$", "mi");
            return loc1.test(arg1);
        }

        public static isURL(arg1: string): Boolean
        {
            var loc1=new RegExp("^(http|https|ftp|file)\\:\\/\\/[\\w\\W]+$", "mi");
            return loc1.test(arg1);
        }

        public static isTel(arg1: string): Boolean
        {
            var loc1=new RegExp("^(\\d{3,4}-?)?(\\d{7,8})(-?\\d+)*$", "mi");
            return loc1.test(arg1);
        }

        public static isMobile(arg1: string): Boolean
        {
            var loc1=new RegExp("^(13|15|18)\\d{9}$", "mi");
            return loc1.test(arg1);
        }

        public static isFilter(arg1: string): Boolean
        {
            var loc1=new RegExp("^[^\\\\\\/\\?\\:\\\"\\<\\>\\|]+$", "mi");
            return loc1.test(arg1);
        }

        public static isChinese(arg1: string): Boolean
        {
            var loc1=new RegExp("[一-龥]", "g");
            return loc1.test(arg1);
        }

        public static isCNID(arg1: string): Boolean
        {
            var loc1=new Array<any>();
            var loc2=null;
            if (!(arg1.length == 15) && !(arg1.length == 18)) 
            {
                return false;
            }
            arg1 = arg1.toUpperCase();
            if (arg1.length == 15) 
            {
                loc2 = arg1.substring(0, 6);
                loc2 = loc2 + "19";
                loc2 = loc2 + arg1.substring(6, 15);
                loc2 = loc2 + ValidatorUitl.getVerify(loc2);
                arg1 = loc2;
            }
            return ValidatorUitl.getVerify(arg1) == arg1.substring(17, 18);
        }

        /* internal  */static getVerify(arg1: string): Object
        {
            var loc1=[7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1];
            var loc2=[1, 0, "X", 9, 8, 7, 6, 5, 4, 3, 2];
            var loc3=[];
            var loc4=0;
            var loc5=0;
            var loc6=0;
            if (arg1.length == 18) 
            {
                arg1 = arg1.substring(0, 17);
            }
            var loc7=0;
            while (loc7 < 17) 
            {
                loc6 = parseInt(arg1.substring(loc7, loc7 + 1));
                loc3[loc7] = loc6 * 1;
                ++loc7;
            }
            var loc8=0;
            while (loc8 < 17) 
            {
                loc5 = loc5 + loc1[loc8] * loc3[loc8];
                ++loc8;
            }
            loc4 = loc5 % 11;
            return loc2[loc4];
        }

        public static isHKID(arg1: string): Boolean
        {
            var loc1={"A": 1, "B": 2, "C": 3, "D": 4, "E": 5, "F": 6, "G": 7, "H": 8, "I": 9, "J": 10, "K": 11, "L": 12, "M": 13, "N": 14, "O": 15, "P": 16, "Q": 17, "R": 18, "S": 19, "T": 20, "U": 21, "V": 22, "W": 23, "X": 24, "Y": 25, "Z": 26};
            var loc2=arg1.substring(0, 7);
            var loc3=loc2.split("");
            var loc4=0;
            var loc5=0;
            var loc6=0;
            var loc7=parseInt(arg1.substring(8, 9)) * 1;
            var loc8=0;
            var loc9=8;
            while (loc8 < 7) 
            {
                loc4 = loc1[loc3[loc8]] || loc3[loc8];
                loc5 = loc5 + loc4 * loc9;
                ++loc8;
                --loc9;
            }
            loc6 = loc5 % 11 != 0 ? 11 - loc5 % 11 : 0;
            return loc7 == loc6;
        }
    }
